package com.twu.biblioteca;

import com.twu.biblioteca.command.Command;

import java.util.LinkedList;
import java.util.Queue;

public class Invoker {

    private Queue<Command> commands;

    public Invoker() {
        this.commands = new LinkedList<Command>();
    }

    public void add(Command command){
        commands.add(command);
    }

    public void execute(){
        while(!commands.isEmpty()){
            commands.poll().execute();
        }

    }

}
